﻿<ResourceDictionary
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    xmlns:theme="clr-namespace:Microsoft.Windows.Themes;assembly=PresentationFramework.Aero"
    xmlns:s="clr-namespace:System;assembly=mscorlib"
    
    xmlns:local="clr-namespace:DataGridFilterLibrary"
    xmlns:support="clr-namespace:DataGridFilterLibrary.Support">
    
    <Style TargetType="{x:Type local:DataGridColumnFilter}">

        <Style.Resources>
            <support:EnumDisplayer Type="{x:Type support:FilterOperator}" x:Key="filterOperators">
                <support:EnumDisplayEntry EnumValue="Undefined" DisplayString=""/>
                <support:EnumDisplayEntry EnumValue="LessThan" DisplayString="&lt;"/>
                <support:EnumDisplayEntry EnumValue="GreaterThan" DisplayString="&gt;"/>
                <support:EnumDisplayEntry EnumValue="Equals" DisplayString="="/>    
                <support:EnumDisplayEntry EnumValue="Like" DisplayString="" ExcludeFromDisplay="True"/>
                <support:EnumDisplayEntry EnumValue="Between" DisplayString="" ExcludeFromDisplay="True"/>
                <support:EnumDisplayEntry EnumValue="LessThanOrEqual" DisplayString="&lt;="/>
                <support:EnumDisplayEntry EnumValue="GreaterThanOrEqual" DisplayString="&gt;="/>
            </support:EnumDisplayer>
            
            <support:CheckBoxValueConverter x:Key="checkBoxValueConverter" />
            <support:ComboBoxToQueryStringConverter x:Key="comboBoxToQueryStringConverter" />
            <support:DatePickerToQueryStringConverter x:Key="datePickerToQueryStringConverter" />
            <support:BooleanToHeightConverter x:Key="booleanToHeightConverter" />
            <support:FontSizeToHeightConverter x:Key="fontSizeToHeightConverter" />
            <support:VisibilityToWidthConverter x:Key="visibilityToWidthConverter" />
            <support:MyBooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />
            <support:MyOppositeBooleanToVisibilityConverter x:Key="oppositeBooleanToVisibilityConverter" />
            <support:ClearFilterButtonVisibilityConverter x:Key="clearFilterButtonVisibilityConverter" />                       

            <Style TargetType="{x:Type support:DelayTextBox}">
                <Setter Property="Background" Value="AliceBlue" />
            </Style>

            <Style TargetType="{x:Type ComboBox}">
                <Setter Property="Background" Value="AliceBlue" />
            </Style>

            <Style TargetType="{x:Type CheckBox}">
                <Setter Property="Background" Value="AliceBlue" />
            </Style>

            <Style TargetType="{x:Type DatePicker}">
                <Setter Property="Background" Value="AliceBlue" />
            </Style>

        </Style.Resources>
        
        <Setter Property="Height" Value="{Binding RelativeSource={RelativeSource Self}, Path=IsControlInitialized, Converter={StaticResource booleanToHeightConverter}}"/>

        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DataGridColumnFilter}">
                    
                    <Border Background="{TemplateBinding Background}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}">

                        <Grid Name="PART_FilterContainer"
                              Visibility="{Binding Path=AssignedDataGridColumn.DoNotGenerateFilterControl, RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, Converter={StaticResource oppositeBooleanToVisibilityConverter}}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="Auto"/>
                                <ColumnDefinition Width="*"/>
                            </Grid.ColumnDefinitions>

                            <!-- Clear Filter Button -->
                            <Button 
                                VerticalAlignment="Top" 
                                Height="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                        Converter={StaticResource fontSizeToHeightConverter},
                                        Path=FontSize}"
                                ToolTip="Clear filter" 
                                
                                Command="{Binding Path=(local:DataGridExtensions.ClearFilterCommand), RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}}"
                                                                
                                Grid.Column="0" Name="PART_ClearFilterButton">
                                
                                <Button.Content>
                                   Clear filter 
                                </Button.Content>
                                
                                <Button.Visibility>
                                    <MultiBinding Converter="{StaticResource clearFilterButtonVisibilityConverter}">
                                        <Binding Path="IsFirstFilterControl" RelativeSource="{RelativeSource TemplatedParent}"/>
                                        <Binding Path="(local:DataGridExtensions.IsClearButtonVisible)" RelativeSource="{RelativeSource AncestorType={x:Type DataGrid}}"/>
                                    </MultiBinding>

                                </Button.Visibility>
                                
                            </Button>
                            <!-- Clear Filter Button -->
                            
                            <!-- Numeric and Text-->
                            <ComboBox 
                                Visibility="Collapsed"
                                VerticalAlignment="Top"
                                Height="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                        Converter={StaticResource fontSizeToHeightConverter},
                                        Path=FontSize}"                                
                                Grid.Column="1" Name="PART_ComboBoxFilterOperator"
                                ItemsSource="{Binding Source={StaticResource filterOperators},Path=DisplayNames}"
  
                                SelectedItem="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                        Path=FilterCurrentData.Operator,
                                        Mode=TwoWay,
                                        Converter={StaticResource filterOperators}}">
                            </ComboBox>
            
                            <support:DelayTextBox
 
                                    Visibility="Collapsed"
                                    VerticalAlignment="Top"
                                    VerticalContentAlignment="Center"
                                    Height="{Binding 
                                            RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                            Converter={StaticResource fontSizeToHeightConverter},
                                            Path=FontSize}"                                
                                     Text="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                        Path=FilterCurrentData.QueryString,
                                        Mode=TwoWay,
                                        UpdateSourceTrigger=Explicit}"
                                        Grid.Column="2" Name="PART_TextBoxFilter">
                                
                            </support:DelayTextBox>
                            <!-- Numeric -->
                            
                            <!-- List -->
                            <ComboBox 
                                Visibility="Collapsed"
                                IsTextSearchEnabled="True"

                                IsEditable="{Binding Path=AssignedDataGridColumn.UserCanEnterText, 
                                        RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                        FallbackValue=False}"  
                                
                                IsReadOnly="False"
                                
                                Height="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                        Converter={StaticResource fontSizeToHeightConverter},
                                        Path=FontSize}"                                

                                SelectedValue="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                        Path=FilterCurrentData.QueryString,
                                        Mode=TwoWay,
                                        Converter={StaticResource comboBoxToQueryStringConverter}}"
                                    
                                Name="PART_ComboBoxFilter" Grid.Column="2">
                            </ComboBox>
                            <!-- List -->
                            
                            <!-- Boolean -->
                            <CheckBox 
                                Visibility="Collapsed"
                                VerticalAlignment="Center"
                                Height="Auto"  
                                
                                IsChecked="{Binding 
                                      RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                      Path=FilterCurrentData.QueryString,
                                      Mode=TwoWay,
                                      UpdateSourceTrigger=PropertyChanged,
                                      Converter={StaticResource checkBoxValueConverter}}"
                                      IsThreeState="True"
                                      Name="PART_CheckBoxFilter" 
                                      ClickMode="Press" HorizontalAlignment="Center" Grid.Column="2"></CheckBox>
                            <!-- Boolean -->
                            
                            <!-- DateTime -->
                            <DatePicker
                                Visibility="Collapsed"
                                VerticalAlignment="Top"
                                
                                Height="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                        Converter={StaticResource fontSizeToHeightConverter},
                                        Path=FontSize}"                                

                                SelectedDate="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                        Path=FilterCurrentData.QueryString,
                                        Mode=TwoWay,
                                        UpdateSourceTrigger=PropertyChanged,
                                        Converter={StaticResource datePickerToQueryStringConverter}}"
                                    
                                Name="PART_DatePickerFilter" Grid.Column="2" />
                            <!-- DateTime -->
                            
                            <!-- NumericBetween -->
                            <Grid Grid.Column="2" 
                                  Visibility="Collapsed"
                                  Name="PART_GridTextFilterBetween"
                                  Width="{Binding RelativeSource={RelativeSource Self}, 
                                                  Path=Visibility, 
                                                  FallbackValue=0,
                                                  Converter={StaticResource visibilityToWidthConverter}}">                                  
                                
                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Margin="1" Grid.Column="0" VerticalAlignment="Center" Height="Auto" >From:</TextBlock>
                                
                                <support:DelayTextBox 
                                        Grid.Column="1" 
                                        VerticalAlignment="Top"
                                        VerticalContentAlignment="Center"
                               
                                        Height="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                        Converter={StaticResource fontSizeToHeightConverter},
                                        Path=FontSize}" 
                                    
                                        Text="{Binding 
                                            RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                            Path=FilterCurrentData.QueryString,
                                            Mode=TwoWay,
                                            UpdateSourceTrigger=Explicit}">
                                </support:DelayTextBox>
                                
                                <TextBlock Margin="1" Grid.Column="2" VerticalAlignment="Center" Height="Auto" >To:</TextBlock>
                                
                                <support:DelayTextBox 
                                        Grid.Column="3" 
                                        VerticalAlignment="Top"
                                        VerticalContentAlignment="Center"
                                    
                                        Height="{Binding 
                                        RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                        Converter={StaticResource fontSizeToHeightConverter},
                                        Path=FontSize}" 
                                    
                                        Text="{Binding 
                                           RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                           Path=FilterCurrentData.QueryStringTo,
                                           Mode=TwoWay,
                                           UpdateSourceTrigger=Explicit}">
                                </support:DelayTextBox>
                            </Grid>
                            <!-- NumericBetween -->
                            
                            <!-- DateTimeBetween -->
                            <Grid Grid.Column="2" 
                                  Name="PART_GridDatePickerFilterBetween"
                                  Visibility="Collapsed"
                                  Width="{Binding RelativeSource={RelativeSource Self}, 
                                                  Path=Visibility, 
                                                  FallbackValue=0,
                                                  Converter={StaticResource visibilityToWidthConverter}}">

                                <Grid.ColumnDefinitions>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                    <ColumnDefinition Width="Auto"/>
                                    <ColumnDefinition Width="*"/>
                                </Grid.ColumnDefinitions>

                                <TextBlock Grid.Column="0" VerticalAlignment="Center" Height="Auto" >From:</TextBlock>

                                <DatePicker
                                        Grid.Column="1" 
                                        VerticalAlignment="Top"
                                        VerticalContentAlignment="Center"
                                
                                        Height="{Binding 
                                                RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                                Converter={StaticResource fontSizeToHeightConverter},
                                                Path=FontSize}"                                

                                        SelectedDate="{Binding 
                                                RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                                Path=FilterCurrentData.QueryString,
                                                Mode=TwoWay,
                                                UpdateSourceTrigger=PropertyChanged,
                                                Converter={StaticResource datePickerToQueryStringConverter}}"/>

                                <TextBlock Grid.Column="2" VerticalAlignment="Center" Height="Auto" >To:</TextBlock>

                                <DatePicker
                                        Grid.Column="3" 
                                        VerticalAlignment="Top"
                                        VerticalContentAlignment="Center"
                                
                                        Height="{Binding 
                                                RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                                Converter={StaticResource fontSizeToHeightConverter},
                                                Path=FontSize}"                                

                                        SelectedDate="{Binding 
                                                RelativeSource={RelativeSource AncestorType={x:Type local:DataGridColumnFilter}}, 
                                                Path=FilterCurrentData.QueryStringTo,
                                                Mode=TwoWay,
                                                UpdateSourceTrigger=PropertyChanged,
                                                Converter={StaticResource datePickerToQueryStringConverter}}"/>

                            </Grid>
                            <!-- DateTimeBetween -->

                        </Grid>

                    </Border>
                    
                    <ControlTemplate.Triggers>
                        
                        <Trigger Property="IsTextFilterControl" Value="true">
                            <Setter TargetName="PART_ComboBoxFilterOperator" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ComboBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_CheckBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_DatePickerFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_GridTextFilterBetween" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_GridDatePickerFilterBetween" Property="Visibility" Value="Collapsed"/>
                            
                            <Setter TargetName="PART_TextBoxFilter" Property="Visibility" Value="Visible"/> 
                            
                        </Trigger>

                        <Trigger Property="IsNumericFilterControl" Value="true">
                            <Setter TargetName="PART_ComboBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_CheckBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_DatePickerFilter" Property="Visibility" Value="Collapsed"/>  
                            <Setter TargetName="PART_GridTextFilterBetween" Property="Visibility" Value="Collapsed"/> 
                            <Setter TargetName="PART_GridDatePickerFilterBetween" Property="Visibility" Value="Collapsed"/>

                            <Setter TargetName="PART_TextBoxFilter" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="PART_ComboBoxFilterOperator" Property="Visibility" Value="Visible"/>
                        
                        </Trigger>

                        <Trigger Property="IsBooleanFilterControl" Value="true">
                            <Setter TargetName="PART_ComboBoxFilterOperator" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ComboBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_TextBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_DatePickerFilter" Property="Visibility" Value="Collapsed"/>                            
                            <Setter TargetName="PART_GridTextFilterBetween" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_GridDatePickerFilterBetween" Property="Visibility" Value="Collapsed"/>
                            
                            <Setter TargetName="PART_CheckBoxFilter" Property="Visibility" Value="Visible"/>
                            
                        </Trigger>

                        <Trigger Property="IsListFilterControl" Value="true">
                            <Setter TargetName="PART_ComboBoxFilterOperator" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_CheckBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_TextBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_DatePickerFilter" Property="Visibility" Value="Collapsed"/>                            
                            <Setter TargetName="PART_GridTextFilterBetween" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_GridDatePickerFilterBetween" Property="Visibility" Value="Collapsed"/>
                            
                            <Setter TargetName="PART_ComboBoxFilter" Property="Visibility" Value="Visible"/>
                            
                        </Trigger>

                        <Trigger Property="IsDateTimeFilterControl" Value="true">
                            <Setter TargetName="PART_ComboBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_CheckBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_TextBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_GridTextFilterBetween" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_GridDatePickerFilterBetween" Property="Visibility" Value="Collapsed"/>

                            <Setter TargetName="PART_DatePickerFilter" Property="Visibility" Value="Visible"/>
                            <Setter TargetName="PART_ComboBoxFilterOperator" Property="Visibility" Value="Visible"/>
                        
                        </Trigger>

                        <Trigger Property="IsNumericBetweenFilterControl" Value="true">
                            <Setter TargetName="PART_ComboBoxFilterOperator" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ComboBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_CheckBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_DatePickerFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_TextBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_GridDatePickerFilterBetween" Property="Visibility" Value="Collapsed"/>
                            
                            <Setter TargetName="PART_GridTextFilterBetween" Property="Visibility" Value="Visible"/>
                            
                        </Trigger>

                        <Trigger Property="IsDateTimeBetweenFilterControl" Value="true">
                            <Setter TargetName="PART_ComboBoxFilterOperator" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_ComboBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_CheckBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_DatePickerFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_TextBoxFilter" Property="Visibility" Value="Collapsed"/>
                            <Setter TargetName="PART_GridTextFilterBetween" Property="Visibility" Value="Collapsed"/>
                            
                            <Setter TargetName="PART_GridDatePickerFilterBetween" Property="Visibility" Value="Visible"/>
                        </Trigger>

                    </ControlTemplate.Triggers>

                </ControlTemplate>
            </Setter.Value>
            
        </Setter>

    </Style>
    
    <Style x:Key="{ComponentResourceKey 
                   TypeInTargetAssembly={x:Type local:DataGridHeaderFilterControl}, 
                   ResourceId=DataGridHeaderFilterControlStyle}"
           TargetType="{x:Type DataGridColumnHeader}">

        <Style.Resources>
            <ResourceDictionary>
                <support:MyBooleanToVisibilityConverter x:Key="booleanToVisibilityConverter" />     
            </ResourceDictionary>

        </Style.Resources>

        <Setter Property="Template">
            
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type DataGridColumnHeader}">

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition />
                        </Grid.ColumnDefinitions>
                        <Grid.RowDefinitions>
                            <RowDefinition />
                            <RowDefinition />
                        </Grid.RowDefinitions>
  
                        <local:DataGridColumnFilter Margin="1" Grid.Column="0" Grid.Row="0"
                        
                            FilterCurrentData ="{Binding 
                                    RelativeSource={RelativeSource AncestorType={x:Type DataGridColumnHeader}}, 
                                    Path=Tag, 
                                    UpdateSourceTrigger=PropertyChanged,
                                    Mode=TwoWay}"
                                                
                            AssignedDataGridColumnHeader ="{Binding 
                                    RelativeSource={RelativeSource AncestorType={x:Type DataGridColumnHeader}}, 
                                    Path=.}"
                                                
                            AssignedDataGridColumn ="{Binding 
                                    RelativeSource={RelativeSource AncestorType={x:Type DataGridColumnHeader}}, 
                                    Path=Column}"
                                                
                            DataGrid ="{Binding 
                                    RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                    Path=.}"   
                        
                            DataGridItemsSource ="{Binding 
                                    RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                    Path=ItemsSource}"
                        
                            Visibility ="{Binding Path=(local:DataGridExtensions.IsFilterVisible),
                                    RelativeSource={RelativeSource AncestorType={x:Type DataGrid}}, 
                                    Converter={StaticResource booleanToVisibilityConverter}}">

                        </local:DataGridColumnFilter>


                        <theme:DataGridHeaderBorder Grid.Column="0" Grid.Row="1" SortDirection="{TemplateBinding SortDirection}"
                                     IsHovered="{TemplateBinding IsMouseOver}"
                                     IsPressed="{TemplateBinding IsPressed}"
                                     IsClickable="{TemplateBinding CanUserSort}"
                                     Background="{TemplateBinding Background}"
                                     BorderBrush="{TemplateBinding BorderBrush}"
                                     BorderThickness="{TemplateBinding BorderThickness}"
                                     Padding ="{TemplateBinding Padding}"
                                     SeparatorVisibility="{TemplateBinding SeparatorVisibility}"
                                     SeparatorBrush="{TemplateBinding SeparatorBrush}">

                            <TextBlock Grid.Column="0" Grid.Row="1"  Text="{TemplateBinding  Content}" 
                                  SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                                  VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
                                  HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
                                       TextWrapping="Wrap"></TextBlock>

                        </theme:DataGridHeaderBorder>

                        <Thumb Grid.Column="0" Grid.Row="1" Name="PART_LeftHeaderGripper" HorizontalAlignment="Left">
                            <Thumb.Style>
                                <Style TargetType="Thumb">
                                    <Style.Resources>
                                        <ResourceDictionary />
                                    </Style.Resources>
                                    <Setter Property="FrameworkElement.Width">
                                        <Setter.Value>
                                            <s:Double>8</s:Double>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Panel.Background">
                                        <Setter.Value>
                                            <SolidColorBrush>#00FFFFFF</SolidColorBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="FrameworkElement.Cursor">
                                        <Setter.Value>
                                            <Cursor>SizeWE</Cursor>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Control.Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="Thumb">
                                                <Border Padding="{TemplateBinding Control.Padding}" Background="{TemplateBinding Panel.Background}" />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Thumb.Style>
                        </Thumb>

                        <Thumb Grid.Column="0" Grid.Row="1" Name="PART_RightHeaderGripper" HorizontalAlignment="Right">
                            <Thumb.Style>
                                <Style TargetType="Thumb">
                                    <Style.Resources>
                                        <ResourceDictionary />
                                    </Style.Resources>
                                    <Setter Property="FrameworkElement.Width">
                                        <Setter.Value>
                                            <s:Double>8</s:Double>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Panel.Background">
                                        <Setter.Value>
                                            <SolidColorBrush>#00FFFFFF</SolidColorBrush>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="FrameworkElement.Cursor">
                                        <Setter.Value>
                                            <Cursor>SizeWE</Cursor>
                                        </Setter.Value>
                                    </Setter>
                                    <Setter Property="Control.Template">
                                        <Setter.Value>
                                            <ControlTemplate TargetType="Thumb">
                                                <Border Padding="{TemplateBinding Control.Padding}" Background="{TemplateBinding Panel.Background}" />
                                            </ControlTemplate>
                                        </Setter.Value>
                                    </Setter>
                                </Style>
                            </Thumb.Style>
                        </Thumb>
                    </Grid>

                </ControlTemplate>
            </Setter.Value>
        </Setter>       
    </Style>

</ResourceDictionary>
